using System.Runtime.Remoting.Contexts;
using CthulhuDomain.Services;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Input;

namespace CthulhuDomain.StageManagement
{
  public class MenuStage : Stage
  {
    public MenuStage(IGameServiceProvider gameServiceProvider) {
      GameServiceProvider = gameServiceProvider;
      BackgroundColor = new ColorAdapter(Color.DarkOliveGreen);
      IRectangle MenuItemDim = new RectangleAdapter(0, 0, 50, 25);
      Menu = new Menu(GameServiceProvider, MenuItemDim);
    }

    protected Menu Menu { get; set; }

    public override sealed IColor BackgroundColor { get; set; }

    public override void Initialize() {
    }

    public override void LoadContent() {
      Menu.EnsureContent();
    }

    public override StateManagerResult Update(IRectangle context, Keys[] keys, IGameTime gameTime) {
      Menu.Update(context, keys, gameTime);
      return new StateManagerResult(eStateManagerResult.Continue, 0);
    }

    public override void Draw() {
      Menu.Draw();
    }
  }
}